package VN.EDU.IMIC.DEVELOPER.DOTHANHTUNG.OOP_MVC_LV1.Calculator;

public class CalculatorController {
	private Calculator operators;
	private CalculatorModel calculatorModel;
	
	//khoi tao controller
	public CalculatorController(Calculator operator){
		operators = operator;
		//khoi tao new model
		calculatorModel = new CalculatorModel();
	}
	
	//method
	
	public String CalculatorValidate(){
		if (calculatorModel.CheckZeroDivideZero(operators)){
			return "Result of function is underfined";
		}
		if (calculatorModel.CheckDivideByZero(operators)){
			return "Cannot divide by Zero";
		}
		return "success";
	}
	
	public double CalculatorInfo(){
		return calculatorModel.Calculate(operators);
	}
}
